package ooo.reindeer.concurrent.netqueue.message;

import ooo.reindeer.data.annotation.Condition;
import ooo.reindeer.data.annotation.DynamicBytes;
import ooo.reindeer.data.annotation.OCTString;

import java.util.Arrays;

public class Message extends Head {

    @Condition(condition = "command", value = {Command.PUT, Command.PUSH}, clazz = Head.class)
    @DynamicBytes
    byte[] data;

    @Condition(condition = "command", value = {Command.PUT_ANSWER, Command.REGISTE_ANSWER, Command.PUSH_ANSWER}, clazz = Head.class)
    @OCTString(5)
    String status;

    public byte[] getData() {
        return data;
    }

    public void setData(byte[] data) {
        this.data = data;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Override
    public String toString() {
        return "Message{" +
                "data=" + Arrays.toString(data) +
                ", status='" + status + '\'' +
                ", command=" + command +
                ", topic='" + topic + '\'' +
                '}';
    }
}
